package xyz.ddlnt.servicemgclient.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.CategoryDTO;
import xyz.ddlnt.model.entity.Category;
import xyz.ddlnt.servicemgclient.client.fallback.CategoryFallbackFactory;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/4/29 22:22
 */
//@FeignClient(name = "service-mg", url = "http://yixuewang-service-mg:9016", path = "/category", fallbackFactory = CategoryFallbackFactory.class)
//@FeignClient(name = "service-mg", url = "http://localhost:9006", path = "/category", fallbackFactory = CategoryFallbackFactory.class)
@FeignClient(value = "service-mg", path = "/category", fallbackFactory = CategoryFallbackFactory.class)
public interface CategoryFeignClient {
    @GetMapping("getAll")
    Result<List<Category>> getAllCategory();

    @GetMapping("getAllName")
    Result<List<CategoryDTO>> getAllCategoryName();

    @PostMapping("add")
    Result<Category> addCategory(@RequestParam String categoryName);

    @DeleteMapping("delete")
    Result<String> deleteCategory(@RequestParam Long id);

    @PutMapping("update")
    Result<LocalDateTime> updateCategory(@RequestBody CategoryDTO categoryDTO);
}
